package cn.com.sinosoft.ares.channel.controller;

import cn.com.sinosoft.ares.channel.service.IInsuranceService;
import cn.com.sinosoft.ares.channel.service.ITemplateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description: 渠道接入对外API层
 * Author: lishangmin
 * Created: 2018-08-08 13:52
 */
@RestController
@Slf4j
public class ChannelController {

    @Autowired
    private ITemplateService templateServiceImpl_MT_0102B;

    @Autowired
    private ITemplateService templateServiceImpl_MT_0102C;

    @Autowired
    private ITemplateService templateServiceImpl_ZT_061598;

    @Autowired
    private IInsuranceService insuranceService;

    @PostMapping(value = "/mt/room/insure/0102b",produces="application/json;charset=UTF-8")
    public String insure_0102b(@RequestBody String message){
        log.info("Message:{}",message);
        String request = templateServiceImpl_MT_0102B.fromXML(message);
        String response = insuranceService.roomDiscountInsure(request);
        return request;
    }

    @PostMapping(value = "/mt/room/insure/0102c",produces="application/json;charset=UTF-8")
    public String insure_0102c(@RequestBody String message){
        log.info("Message:{}",message);
        String request = templateServiceImpl_MT_0102C.fromXML(message);

        return request;
    }

    @PostMapping(value = "/zt/room/insure/061598",produces="application/json;charset=UTF-8")
    public String insure_061598(@RequestBody String message){
        log.info("Message:{}",message);
        String request = templateServiceImpl_ZT_061598.fromJSON(message);

        return request;
    }

}
